import { defineConfig } from "vite";
import Vue from "@vitejs/plugin-vue";
import Components from "unplugin-vue-components/vite";
import AutoImport from "unplugin-auto-import/vite";
import { NaiveUiResolver } from "unplugin-vue-components/resolvers";
import { dirResolver, DirResolverHelper } from "vite-auto-import-resolvers";
import { resolve } from "path";
import optimizer from "vite-plugin-optimizer";
import vueJsx from '@vitejs/plugin-vue-jsx'
export default defineConfig({
	resolve: {
		alias: {
			"@": resolve(__dirname, "./src"),
		},
	},
	plugins: [
    Vue(),
    vueJsx(),
		optimizer({
			child_process: () => ({
				find: /^(node:)?child_process$/,
				code: `const child_process = import.meta.glob('child_process'); export { child_process as default }`,
			}),
		}),
		DirResolverHelper(),
		Components({
			resolvers: [NaiveUiResolver()],
		}),
		AutoImport({
			imports: ["vue", "vue-router", "pinia"],
			resolvers: [dirResolver()],
		}),
	],

	css: {
		preprocessorOptions: {
			less: {
				modifyVars: {},
				javascriptEnabled: true,
			},
		},
	},
});
